﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>User Assemblies</title>
</head>
<body>

    <p>In the CTP file we specified the full path to user assemblies. For example:
</p><p style="MARGIN-LEFT: 40px">USER:C:\source\CrossTalk\source\CrossTalkRightTest\bin\Debug\CrossTalkRightTest.dll
</p><p>The full path is fine and needed during the generation phase. However the generator also emits this path into the .pas files. In CTCrossTalkRightTest.pas this is generated:
</p><p style="MARGIN-LEFT: 40px">initialization<br>&nbsp; LoadAssembly('C:\source\CrossTalk\source\CrossTalkRightTest\bin\Debug\CrossTalkRightTest.dll');<br>end.
</p><p>This will work while debugging, however you are unlikely to deploy your assembly in this location on your users machines. You could change this path, however it a .pas file that is autogenerated and not intended for changes. Because of this, at runtime CrossTalk will actually try to load the assembly first from the User Path.
</p><h3>User Path
</h3><p>The UserPath is the path where the application that calls CrossTalk exists. Normally this is your exe, but if you put your CrossTalk units in a DLL or a package, then the User Path will be the path where that DLL or package exists. This may or may not be the same as the exe.
</p><p>So in our example the Delphi code creates an exe and it is deployed to C:\Program Files\My App\app.exe, then CrossTalk would first look for C:\Program Files\My App\CrossTalkRightTest.dll. If CrossTalk does not find it there, then it will look in the actual path specified.
</p><p>This allows for easy deployment, and debugging scenarios.
</p><h3>Gotcha
</h3><p>The one thing you need to watch out for is during debugging. If you happen to copy the assembly to the application directory for testing, remember that CrossTalk will always give it priority over your debug version even if you rebuild the debug version. We considered looking for both and loading the newer one, but has more serious side effects.</p>

</body>
</html>
